#ifndef ENUM_AND_DATA_H_INCLUDED
#define ENUM_AND_DATA_H_INCLUDED

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <conio.h>

#include <array>
#include <list>
#include <bitset>
#include <cmath>
#include <iterator>
#include <limits.h>

#include <windows.h>
#include <tchar.h>
#include <chrono>
#include <easyx.h>
#include <graphics.h>

using namespace std;
//---enum类型声明---
enum PAGE{
    UNKNOWN = -1, WELCOME=0, MENU=1, SEARCH=2, ASSIST=9,
    BUY_SELECT=31, BUY_PAY=32, BUY_FINISH=331, GIVEBACK=332,
};
enum SELECT{
    FINISH=0, START=1, END=2, FIND=3, TICKET=4
};
enum MES{
    ZERO=0, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE,
    NONE=-1, EXIT=10, ENTER=11, A=12, B=13, C=14, BACK=15, HELP=16
};

//不会用配置文件，就拿头文件当配置文件用了
//---常量配置---
inline const int win_width             = 1600;
inline const int win_height            = 1000;
inline const int letter_width          = 18;
inline const int letter_height         = 36;    //这4个的单位为像素
inline const int max_station_number    = 24;
inline const int max_ticket            = 50;
inline const int detect_num            = 17;
inline const int input_chart_deep      = 2;     //这4个没有单位
inline const int refresh_cycle         = 500;
inline const int flash_cycle           = 2000;
inline const int wait_time_giveback    = 3000;
inline const int wait_time_finish      = 3000;  //这4个的单位为毫秒
/*目前
win_width, win_height, letter_width, letter_height    涉及排版禁止修改
---
detect_num, input_chart_deep                          涉及算法禁止修改，当然后者可能有兼容性修改
---
max_ticket                                            只能在不与input_chart_deep冲突的前提下修改
                                                      <= 0直接汇报错误退出
---
max_station_number                                    修改时应与地图数据相匹配
                                                      只能在不与input_chart_deep冲突的前提下修改
                                                      <= 0直接汇报错误退出
---
refresh_cycle                                         不宜过小，否则将导致垂直同步失效
                                                      <= 0直接汇报错误退出
---
flash_cycle, wait_time_giveback, wait_time_finish     应为refresh_cycle正整数倍，否则将导致垂直同步失效
*/

//---路径配置---
inline const char* wel_path         = ".\\img\\welcome.png";
inline const char* info_path        = ".\\img\\info.png";
inline const char* menu_path        = ".\\img\\menu.png";
inline const char* instruct_path    = ".\\img\\instruct.png";
inline const char* frame_path       = ".\\img\\frame.png";
inline const char* map_path         = ".\\img\\map.png";
inline const char* search_path      = ".\\img\\search.png";
inline const char* buy_path         = ".\\img\\buy.png";
inline const char* pay_path         = ".\\img\\pay.png";
inline const char* finish_path      = ".\\img\\finish.png";
inline const char* giveback_path    = ".\\img\\giveback.png";

inline const TCHAR* warning_zero    = "您尚未输入数值";
inline const TCHAR* warning_over    = "您输入的数值过大";

//---监测按键输入列表---
inline const array<int, detect_num> keyUnderDetect = {
    0x30, 0x31, 0x32, 0x33, 0x34,
    0x35, 0x36,0x37, 0x38, 0x39,            //0~9
    VK_ESCAPE, VK_RETURN,                   //ESC, ENTER
    0x41, 0x42, 0x43, VK_BACK, VK_F1        //A~C, BACK, HELP
};

//---图像文字坐标数据---
typedef struct POS{
    int x;
    int y;
}pos;
//地图中站点的图像坐标，按照编号顺序1~24
inline const pos station_picture[24] = {
    {635,177},  {516,177},  {398,177},  {277,177},  {161,177},  {26,177},
    {517,47},   {517,307},  {517,435},  {517,562},  {517,691},  {517,818},
    {517,947},  {635,562},  {398,562},  {277,562},  {151,562},  {277,29},
    {277,307},  {277,691},  {277,818},  {753,818},  {635,818},  {151,818},
};
//文字坐标基准，可能有缩放兼容性修改
inline const int line_gap       = 24;
inline const int text_end_left  = 360;
inline const int text_end_right = 1080;
inline const int text_top       = 360;
//  输入框数字的坐标列表
inline constexpr pos number_picture[4 * input_chart_deep + 1] = {
    {text_end_right + 2, text_top},                                 {text_end_right + letter_width + 4, text_top},                                   //“起点”输入框
    {text_end_right + 2, text_top + letter_height + line_gap},      {text_end_right + letter_width + 4, text_top + letter_height + line_gap},        //“终点”输入框
    {text_end_right + 2, text_top + letter_height*3 + line_gap*3},  {text_end_right + letter_width + 4, text_top + letter_height*3 + line_gap*3},    //“票数”输入框
    {text_end_right + 2, text_top},                                 {text_end_right + letter_width + 4, text_top},                                   //“查询站点”输入框
    {0, 0},  //预留来溢出的超尾，少写个if-else
};

//---地图拓扑数据---
//换乘站编号数组，从小到大
const int cross_number = 6;
inline array<int, cross_number> cross = {2, 4, 10, 12, 16, 21};
//两个换乘站之间的最短段数，可能更新自动计算函数，目前为手推
inline array<int, cross_number*cross_number> dist = {
    0, 2, 3, 5, 4, 6,
    2, 0, 4, 5, 2, 4,
    3, 4, 0, 2, 2, 3,
    5, 5, 2, 0, 3, 1,
    4, 2, 2, 3, 0, 2,
    6, 5, 4, 1, 2, 0,
};

//站点排列顺序，带有成员标识是否为换乘站
typedef struct STATION{
    int _number;
    bool _is_cross;
}station;
const int line_number = 5;
inline list<station> line1 = {{1,0},    {2,1},      {3,0},      {4,1},      {5,0},      {6,0}};
inline list<station> line2 = {{7,0},    {2,1},      {8,0},      {9,0},      {10,1},     {11,0},     {12,1},     {13,0}};
inline list<station> line3 = {{14,0},   {10,1},     {15,0},     {16,1},     {17,0}};
inline list<station> line4 = {{18,0},   {4,1},      {19,0},     {16,0},     {20,0},     {21,1}};
inline list<station> line5 = {{22,0},   {23,0},     {12,1},     {21,1},     {24,0}};
inline list<station> line_list[] = {line1, line2, line3, line4, line5}; //用引用怎么都过不了编译，反正也是存指针

//---用于表示投币金额的结构体cash---
typedef struct CASH{
    int number_10yuan;
    int number_5yuan;
    int number_1yuan;
}cash;
#endif // ENUM_AND_DATA_H_INCLUDED
